#
# DCO2 makefile
#

#PYTHON=/usr/local/python2.0/bin/python
#PYTHON=python
PYTHON=python

all: install

.config: src/Setup.in.dco src/testora
	(cd src; \
	./testora $(PYTHON))
	@touch .config

src/Setup: .config src/Setup.in 
	(cd src; \
	cp -p Setup.in Setup )

src/Makefile: src/Setup
	(cd src; \
	$(MAKE) -f Makefile.pre.in boot PYTHON=$(PYTHON) || ./setuperrors; \
	$(MAKE) dummy || ./setuperrors)

src/dco2.so: src/Makefile src/Setup src/dco2.c
	( cd src; \
	$(MAKE) || ./builderrors)

DCOracle2/dco2.so: src/dco2.so
	cp src/dco2.so DCOracle2

install: DCOracle2/dco2.so

test:  testdir

testdir:
	(cd test; \
	$(MAKE) test)

clean:
	(cd src; \
	$(MAKE) clean; \
	rm -f dco2.so )
	(cd test; \
	$(MAKE) clean)
	rm -f DCOracle2/*.pyc test/*.pyc DCOracle2/dco2.so

distclean: clean
	rm -f .config src/Setup src/Setup.in src/Makefile src/Makefile.pre src/sedscript src/config.c 

